<%@ page contentType="text/html;charset=UTF-8"%>
<%@ include file="/WEB-INF/common/taglibs.jsp"%>
<!DOCTYPE html>
<html class="ng-app:myApp" id="ng-app" ng-app="myApp" xmlns:ng="http://angularjs.org">
<head>
<title>订单</title>
<%@ include file="/WEB-INF/common/meta.jsp"%>
<%@ include file="/WEB-INF/layouts/global_res_header.jsp"%>
<style type="text/css">
	#ooo li{
		list-style: none;
	}
</style>
</head>

<body ng-controller="orderHeadCtrl">
	<div id="mainDataBlock" ng-grid="gridOptions"></div>
	<div id="funcBlock" class="alert alert-info">
		<div class="btn-group btn-group-sm">
			<button type="button" class="btn btn-default" ng-click="onOpenQueryFormModal()">
				<span class="glyphicon glyphicon-search"></span>
				查询
			</button>
			<button type="button" class="btn btn-default" ng-click="refresh()">
				<span class="glyphicon glyphicon-refresh"></span> 刷新
			</button>
			<shiro:hasPermission name="oms:orderHead:import">
			<button type="button" class="btn btn-default" ng-click="onOpenImportFormModal()">
				<span class="glyphicon glyphicon-import"></span>
				导入
			</button>
			</shiro:hasPermission>
			<shiro:hasPermission name="oms:orderHead:export">
			<button type="button" class="btn btn-default" ng-click="onOpenExportFormModal()">
				<span class="glyphicon glyphicon-export"></span>
				导出
			</button>
			</shiro:hasPermission>			
		</div>
	</div>
</body>

<div id="queryFormModal" class="modal" tabindex="-1" data-width="480px">
	<div class="modal-header">
		<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
		<h4 class="modal-title">查询</h4>
	</div>
	<div class="modal-body">
		<div class="row">
			<div class="col-md-12">
				<form name="queryFormForm" class="form-inline" role="form">
					<div class="form-group" style="margin-left: 58px;">
						<label for="clientId">客户</label>
						<select name="clientId" ui-select2="{width:'150px', allowClear:'true'}" ng-model="queryForm.clientId" style="width: 100%" class="select2" data-placeholder="客户">
							<option value=""></option>
							<option value=""></option>
							<option ng-repeat="client in clientList" value="{{client.id}}">{{client.shortName}}</option>
						</select>
					</div>
					<div class="form-group">
						<label for="cd">订单号</label>
						<input name="cd" ng-model="queryForm.cd" class="form-control" placeholder="订单标识">
					</div>
					<div class="form-group top" style="margin-left: 34px;">
						<label for="vocation">业务类型</label>
						<select name="vocation" ui-select2="{width:'150px', allowClear:'true'}" ng-model="queryForm.vocation" class="select2" data-placeholder="订单类型">
							<option value=""></option>
							<option value=""></option>
							<option ng-repeat="vocation in cdList" value="{{vocation.descr}}">{{vocation.val}}</option>
						</select>
					</div>
					<div class="form-group top" style="margin-left: 12px;">
						<label for="status">状态</label>
						<select name="status" ui-select2="{width:'150px', allowClear:'true'}" ng-model="queryForm.status" class="select2" data-placeholder="状态">
							<option value=""></option>
							<option value=""></option>
							<option ng-repeat="status in statusList1" value="{{status.descr}}">{{status.val}}</option>
						</select>
					</div>
					<div class="form-group top">
						<span class="spancss">*</span>
						<label for="status">计划到达时间</label>
						<input name="planaDt1" required ng-model="queryForm.planaDt1" class="form-control" placeholder="开单时间" />								
					</div>
					<div class="form-group top" style="margin-left: 24px;">
						<label for="status">至</label>
						<input required name="planaDt2" ng-model="queryForm.planaDt2" class="form-control" placeholder="开单时间" />								
					</div>
					<div class="form-group top" style="margin-left: 34px;">
						<label for="cd1">批量单号</label>
						<textarea style="width: 342px;"  name="cd1" ng-model="queryForm.cd1" class="form-control"></textarea>
					</div>
				</form>
			</div>
		</div>
	</div>
	<div class="modal-footer">
		<button type="button" data-dismiss="modal" class="btn btn-default">关闭</button>
		<button id="cx" ng-click="onQuery()" ng-disabled="queryFormForm.$invalid" class="btn btn-default">查询</button>
	</div>
</div>

<div id="editFormModal" class="modal" tabindex="-1" data-width="1080">
	<div class="modal-header">
		<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
		<h4 class="modal-title">订单信息管理</h4>
	</div>
	<div class="modal-body">
		<div class="row">
			<div class="col-md-12">
				<form name="editFormForm" role="form" novalidate>
					<input type="hidden" name="id" ng-model="editForm.id" class="form-control">
					<input type="hidden" name="shipment_method" ng-model="editForm.shipment_method" class="form-control">
					<div class="row">
						<div class="col-sm-3">								
							&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="spancss">*</span>客户： <select name="clientId" ng-disabled="flagOfClientCd" id="e" ng-required="true" ui-select2="{width:'150px', allowClear:'true'}" ng-model="editForm.clientId" style="width: 100%" class="select2" data-placeholder="客户">
								<option value=""></option>
								<option ng-repeat="client in clientList" value="{{client.id}}">{{client.shortName}}</option>
							</select>
						</div>
						<div class="col-sm-3">									
							&nbsp;&nbsp;<span class="spancss">*</span>订单号： <input ng-disabled="flagOfCd" name="cd" ng-model="editForm.cd" required class="form-control" placeholder="订单号">
						</div>
						<div class="col-sm-3">
							&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="spancss">*</span>业务类型： <select name="vocation" ui-select2="{width:'150px', allowClear:'true'}" ng-model="editForm.vocation" style="width: 100%" class="select2" data-placeholder="业务类型">
								<option value=""></option>
								<option ng-repeat="cd in cdList" value="{{cd.descr}}">{{cd.val}}</option>
							</select>
						</div>
						<div class="col-sm-3">
							&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="spancss">*</span>订单类型： <select name="orderTypeId" ng-required="true" ui-select2="{width:'150px', allowClear:'true'}" ng-model="editForm.orderTypeId" style="width: 100%" class="select2" data-placeholder="订单类型" id="ot">
								<option value=""></option>
								<option ng-repeat="orderType in orderTypeList" value="{{orderType.id}}">{{orderType.name}}</option>
							</select>
						</div>
					</div>
					<hr>
					<div class="row">
						<div class="col-sm-3">
							开单时间： <input name="orderDt" ng-model="editForm.orderDt"class="form-control"  placeholder="开单时间" />								
						</div>
						<div class="col-sm-3">							
							计费周期： <input name="billingDt" ng-model="editForm.billingDt" class="form-control" placeholder="计费周期">
						</div>
						<div class="col-sm-3">
							计划出发时间： <input name="planlDt" ng-model="editForm.planlDt" class="form-control" placeholder="计划出发时间">
						</div>
						<div class="col-sm-3">
							<span class="spancss">*</span>计划到达时间： <input name="planaDt" ng-model="editForm.planaDt" class="form-control" placeholder="计划到达时间">
						</div>
					</div>
					<hr>
					<div class="row top">
						<div class="col-sm-3">
							&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;数量： <input name="quantity" ng-model="editForm.quantity" class="form-control" placeholder="数量">
						</div>
						<div class="col-sm-3">							
							&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;重量： <input name="weight" ng-model="editForm.weight" class="form-control" placeholder="重量">
						</div>
						<div class="col-sm-3">
							&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;体积： <input name="volume" ng-model="editForm.volume" class="form-control" placeholder="体积">
						</div>
						<div class="col-sm-3">
							&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;托数： <input name="palletsum" ng-model="editForm.palletsum" class="form-control" placeholder="托数">
						</div>
					</div>
					<div class="row top">
						<div class="col-sm-3">							
							&nbsp;&nbsp;&nbsp;&nbsp;一口价： <input name="expense" ng-model="editForm.expense" class="form-control" placeholder="一口价">
						</div>
						<div class="col-sm-3">										
							运输方式： <select name="shipment_method" ui-select2="{width:'150px', allowClear:'true'}" ng-model="editForm.shipment_method" class="select2" data-placeholder="业务类型">
								<option value=""></option>
								<option value=""></option>
								<option ng-repeat="shipment_method in shipment_methodList" value="{{shipment_method.descr}}">{{shipment_method.val}}</option>
							</select>
						</div>
						<div class="col-sm-3">
							&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;备注： <input name="descr" ng-model="editForm.descr" class="form-control" placeholder="描述">
						</div>
					</div>
					<hr>
					<div class="row">
						<div class="col-sm-4">								
							&nbsp;&nbsp;<span class="spancss">*</span>发货方代码： <select name="freceiverId" ng-required="true" id="f" ui-select2="{width:'150px', allowClear:'true'}" ng-model="editForm.freceiverId" class="select2" data-placeholder="发货方标识">
								<option value=""></option>
								<option ng-repeat="receiver in receiverList" value="{{receiver.id}}">{{receiver.cd}}</option>
							</select>
						</div>
						<div class="col-sm-4">							
							&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;发货方名称： <input name="freceiverName" ng-model="editForm.freceiverName" class="form-control" placeholder="发货方名称">
						</div>
						<div class="col-sm-4">						
							&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="spancss">*</span>出发地： <select name="ftranslocationId" ng-required="true" ui-select2="{width:'150px', allowClear:'true'}" ng-model="editForm.ftranslocationId" class="select2" data-placeholder="出发地">
								<option value=""></option>
								<option ng-repeat="translocation in translocationList" value="{{translocation.id}}">{{translocation.name}}</option>
							</select>
						</div>
					</div>
					<div class="row top">
						<div class="col-sm-4">
							发货方联系人： <input name="freceiverLikename" ng-model="editForm.freceiverLikename" class="form-control" placeholder="发货方联系人">
						</div>
						<div class="col-sm-4">
							发货方联系电话： <input name="freceiverPhone" ng-model="editForm.freceiverPhone" class="form-control" placeholder="发货方联系电话">
						</div>
						<div class="col-sm-4">
							发货方传真： <input name="freceiverFax" ng-model="editForm.freceiverFax" class="form-control" placeholder="发货方传真">
						</div>
					</div>
					<div class="row top">
						<div class="col-sm-4">
							&nbsp;&nbsp;&nbsp;&nbsp;发货方邮箱： <input name="freceiverEmail" ng-model="editForm.freceiverEmail" class="form-control" placeholder="发货方邮箱">
						</div>
						<div class="col-sm-4">							
							&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;发货方邮编： <input name="freceiverPostcode" ng-model="editForm.freceiverPostcode" class="form-control" placeholder="发货方邮编">
						</div>
						<div class="col-sm-4">							
							发货方地址： <input name="freceiverAddress" ng-model="editForm.freceiverAddress" class="form-control" placeholder="发货方地址">
						</div>
					</div>
					<hr>
					<div class="row">
						<div class="col-sm-4">								
							&nbsp;&nbsp;<span class="spancss">*</span>收货方代码： <select name="treceiverId" id="s" ng-required="true" ui-select2="{width:'150px', allowClear:'true'}" ng-model="editForm.treceiverId" style="width: 100%" class="select2" data-placeholder="收货方标识">
								<option value=""></option>
								<option ng-repeat="receiver in receiverList" value="{{receiver.id}}">{{receiver.cd}}</option>
							</select>
						</div>
						<div class="col-sm-4">							
							&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;收货方名称： <input name="treceiverName" ng-model="editForm.treceiverName" class="form-control" placeholder="收货方名称">
						</div>
						<div class="col-sm-4">								
							&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="spancss">*</span>目的地： <select name="ttranslocationId" ng-required="true" ui-select2="{width:'150px', allowClear:'true'}" ng-model="editForm.ttranslocationId" class="select2" data-placeholder="出发地">
								<option value=""></option>
								<option ng-repeat="translocation in translocationList" value="{{translocation.id}}">{{translocation.name}}</option>
							</select>
						</div>
					</div>
					<div class="row top">
						<div class="col-sm-4">						
							收货方联系人： <input name="treceiverLikename" ng-model="editForm.treceiverLikename" class="form-control" placeholder="收货方联系人">
						</div>
						<div class="col-sm-4">							
							收货方联系电话： <input name="treceiverPhone" ng-model="editForm.treceiverPhone" class="form-control" placeholder="收货方联系电话">
						</div>
						<div class="col-sm-4">							
							收货方传真： <input name="treceiverFax" ng-model="editForm.treceiverFax" class="form-control" placeholder="收货方传真">
						</div>
					</div>
					<div class="row top">
						<div class="col-sm-4">							
							&nbsp;&nbsp;&nbsp;&nbsp;收货方邮箱： <input name="treceiverEmail" ng-model="editForm.treceiverEmail" class="form-control" placeholder="收货方邮箱">
						</div>
						<div class="col-sm-4">							
							&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;收货方邮编： <input name="treceiverPostcode" ng-model="editForm.treceiverPostcode" class="form-control" placeholder="收货方邮编">
						</div>
						<div class="col-sm-4">							
							收货方地址： <input name="treceiverAddress" ng-model="editForm.treceiverAddress" class="form-control" placeholder="收货方地址">
						</div>
					</div>
				</form>
			</div>
		</div>
	</div>
	<div style="width: 1075px;">
		<div id="mainData" ng-grid="gridOption" style="width: 100%;"></div>
	</div>
	<div class="modal-footer">
		<button type="button" data-dismiss="modal" class="btn btn-default">关闭</button>
		<button ng-click="onSaveEditForm()" ng-disabled="disabledSubmitBtnOfEditForm" class="btn btn-default">提交</button>
	</div>
</div>

<div id="importFormModal" class="modal" tabindex="-1" data-width="400px" style="display: none;">
	<div class="modal-header">
		<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
		<h4 class="modal-title">导入</h4>
	</div>
	<div class="modal-body">
		<div class="row">
			<div class="col-md-12">
				<form name="importFormForm" action="{{importForm.importUrl}}" target="_blank" method="post" enctype="multipart/form-data" class="form-horizontal" role="form">
					<div class="form-group">
						<div class="col-sm-8">
							<input name="importUrl" id="importUrl" ng-required="true" ng-model="importForm.importUrl" class="form-control" placeholder="导入" style="display: none;">
						</div>
					</div>
					<div class="form-group">
						<label for="file" class="col-sm-3 control-label" style="width: 70px;">文件</label>
						<div style="float: left; margin-right: 10px;">
							<input type="file" name="file" class="form-control">
						</div>
						<div style="float: left;">
							<button ng-click="onExportTemplate()" type="button" class="btn btn-success" style="height: 30px; padding: 4px 6px;">下载模板</button>
						</div>
					</div>
				</form>
			</div>
		</div>
	</div>
	<div class="modal-footer">
		<button type="button" data-dismiss="modal" class="btn btn-default">关闭</button>
		<button type="button" ng-disabled="importFormForm.$invalid" ng-click="onImport()" class="btn btn-primary">导入</button>
	</div>
</div>

<div id="formModal" class="modal" tabindex="-1" data-width="300px" style="display: none;">
	<div class="modal-header">
		<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
		<h4 class="modal-title">消息</h4>
	</div>
	<div class="modal-body">
		<div class="row">
			<div class="col-md-12">
				失效失败的订单号：
				<ul id="ooo"></ul>
			</div>
		</div>
	</div>
	<div class="modal-footer">
		<button type="button" data-dismiss="modal" class="btn btn-default">关闭</button>
	</div>
</div>

<div class="contextMenu" id="menu">
	<ul>
		<li id="find" ng-click="onOpenQueryFormModal()">
		 <img src=""/> 
		&nbsp;查询&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</li>
		<li id="refresh" ng-click="refresh()">
		 <img src=""/> 
		&nbsp;刷新&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</li>
		<shiro:hasPermission name="oms:driver:add">
		<li id="save" ng-click="onOpenEditFormModal('add')">
		 <img src=""/> 
		&nbsp;增加&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</li>
		</shiro:hasPermission>
		<shiro:hasPermission name="oms:orderHead:del">
		<li id="del" ng-click="del()">
		 <img src=""/> 
		&nbsp;删除&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</li>
		</shiro:hasPermission>
		<shiro:hasPermission name="oms:orderHead:upd">
		<li id="edit" ng-click="onOpenEditFormModal('upd')">
		 <img src=""/> 
		&nbsp;编辑&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</li>
		</shiro:hasPermission>
		<shiro:hasPermission name="oms:orderHead:arrived">
		<li id="arrived" ng-click="onChangeSt('ARRIVED', '生效')">
		 <img src=""/> 
		&nbsp;生效&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</li>
		</shiro:hasPermission>
		<shiro:hasPermission name="oms:orderHead:back">
		<li id="back" ng-click="onChangeSt('INPUT', '失效')">
		 <img src=""/> 
		&nbsp;失效&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</li>
		</shiro:hasPermission>
	</ul>
</div>
<%@ include file="/WEB-INF/layouts/global_res_footer.jsp"%>
<script type="text/javascript" src="${ctx}/res_oms/oms/orderHead.js"></script>
<script type="text/javascript" src="${ctx}/res_oms/jquery.contextmenu.r2.js"></script>
</html>
